package com.joymart.protocol.rest;


import com.joymart.protocol.model.Protocol;
import com.joymart.protocol.service.ProtocolService;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.*;

@RestController
public class ProtocolController {


    @Autowired
    private ProtocolService protocolService;

    @GetMapping("/protocols/{type}/latest")
    public Object getLatestProtocol(@PathVariable String type) {
        return protocolService.getLatestProtocol(type);
    }

    @GetMapping("/protocols/{id}")
    public Object getProtocol(@PathVariable String id) {
        return protocolService.findById(id);
    }


}
